﻿<!doctype html>
<html xmlns:th="http://www.thymeleaf.org">
<header class="header-area inner-page">
    <th:block th:include="commons/front::public-resource">LOGIN</th:block>
    <th:block th:include="commons/front::login-bar">login-bar</th:block>
    <th:block th:include="commons/front::navigation">navigation</th:block>
    <link th:href="@{/public/front/css/page.css}" rel="stylesheet">
    <script type="text/javascript" th:src="@{/public/front/js/jquery.z-pager.js}"></script>
    <title>用户信息</title>
</header>
<header url="/front/discover"></header>
<style>
    .class-details h3 a {
        font-size: 28px;
        color: #141514;
    }

    .remove-btn {
        visibility: hidden;
        position: absolute;
        right: 0px;
        font-size: 20px
    }

    .class-meta p {
        text-align: center;
    }
</style>
<body>

<ol class="breadcrumb">
    <li title="返回上一页"><a href="javascript:history.go(-1);">
        <span class="glyphicon glyphicon-chevron-left"></span>
    </a></li>
</ol>

<!-- Team Section -->
<section class="team-section teacher-page">
    <div class="container">
        <div class="row">
            <div class="col-sm-6 col-xs-12 left-align">
                <h2 class="title">我的收藏</h2>
                <p class="subtitle color" id="sologan">
                </p>
            </div>
        </div>
        <div class="row" id="collectContainer">

        </div>
    </div>
</section>
<!-- /.team-section -->

<template id="collect-list-template">
    {%each(i,s) data %}
    <div class="col-sm-6 col-md-4 col-xs-12 text-center float-left">
        <div class="single-team" style="position: relative">
            <div style="cursor: pointer;" class="class-img"
                 onclick="location.href=ctx+'/front/user_info_detail/${s.customerId}/${s.id}';">
                <img alt="" src="${s.imgUrl}" onerror="loadError(this)" style="background-size: 100% auto; height: 243px; object-fit: cover">
                <div class="class-hover">
                    <a class="popup" href='javascript:;' onclick="location.href=ctx+'/front/user_info_detail/${s.customerId}/${s.id}';">
                        <span class="glyphicon glyphicon-link"></span>
                    </a>
                </div>
            </div>
            <div class="class-details">
                <div>
                    <div class="text-title text-single-line" title="${s.source}"
                         style="text-align: center; margin-bottom: 5px; width: auto; font-weight: 400; font-size: 24px" title="${s.source}">
                        <a href="javascript:;" style="color: #141514;" onclick="location.href=ctx+'/front/user_info_detail/${s.customerId}/${s.id}';">${s.source}</a>
                    </div>
                </div>
                <p style="margin-top: 5px; line-height: 23px" class="text-single-line">${s.descrption}</p>
                <div class="clearfix row">
                    <div class="class-meta" style="display: inline-block; width: auto;">
                        <span><a class="text-single-line text-center" style="width: 66px;" href="javascript:;" title="${s.customerName}"
                                 onclick="userInfo(${s.customerId})">${s.customerName}</a></span>
                        <p><img src="${s.headImg}" style="width: 20px; height: 20px;"></p>
                    </div>
                    <div class="class-meta" style="display: inline-block">
                        <span>浏览</span>
                        <p>${s.scanCount}</p>
                    </div>
                    <div class="class-meta" style="display: inline-block">
                        <span>收藏</span>
                        <p>${s.collectCount}</p>
                    </div>
                    <div class="class-meta" style="display: inline-block">
                        <span>评论</span>
                        <p>${s.commentCnt}</p>
                    </div>
                </div>
            </div>
        </div>
    </div>
    {%/each%}
</template>

<th:block th:include="commons/front::footer">FOOTER</th:block>
<th:block th:include="commons/front::login">LOGIN</th:block>
<script>
    $(function () {
        if (isLogin()) {
            $.get(ctx + "/front/collectData", {customerId: getUserInfo().id}, function (rtn) {
                $("#collect-list-template").tmpl(rtn).appendTo('#collectContainer');
            })
        }
    });

    function userInfo(customerId) {
        if (isLogin()) {
            var loginCustomerId = $("#customerId").val();
            // 查询自建的作品
            if (loginCustomerId == customerId) {
                location.href=ctx + '/front/user_info/'+customerId+"/0";
                return;
            }
        }
        location.href=ctx + '/front/user_info/'+customerId+"/1";
    }
</script>

</body>
</html>